<template>
  <div id="app">
    <HelloWorld msg="Welcome to Your Vue.js App" />
    <HelloWorld2 />
    <HelloWorld3 />
  </div>
</template>

<script>
import HelloWorld from "./components/HelloWorld.vue";
import HelloWorld2 from "./components/HelloWorld2.vue";
import HelloWorld3 from "./components/HelloWorld3.vue";

export default {
  name: "App",
  components: {
    HelloWorld,
    HelloWorld2,
    HelloWorld3,
  },
  created() {
    this.$Store.setDefault({
      key1: 1,
      key2: [1],
      key3: {
        c: 1,
      },
      funKey: () => {
        console.log("触发一次");
      },
    });
  },
  mounted() {
    this.$Store.subscribe("key3", () => {
      console.log(`这里是Home组件，key3更新`);
    });
    this.$Store.subscribe("funKey", () => {
      console.log(`这里是Home组件，funKey被触发`);
    });

    console.log("新的store=======", this.$Store);
  },
};
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
